﻿using System;
using System.Globalization;
using Medianamik.Core;
using Medianamik.Core.DAL;
using Medianamik.Core.DAL.Repositories;
using Medianamik.Core.DAL.Services;
using SubSonic;

namespace Medianamik.UI.Web.Shop.Data.Repositories
{
    public class ClientProfileRepository<TCollection, TItem> : MedianamikRepository<TCollection, TItem>, IClientProfileRepository<TItem>
        where TItem : Interfaces.IClientProfile, IRecordBase, new()
        where TCollection : ICollectionWithChildren<TCollection, TItem>, new()
    {
        public ClientProfileRepository(ICultureService cultureService, IContentStateService contentStateService, INodeMapper nodeMapper) : base(cultureService, contentStateService, nodeMapper)
        {
        }
    }

    public class ClientProfileRepository : ClientProfileRepository<ClientProfileCollection, ClientProfile>, IClientProfileRepository
    {
        public ClientProfileRepository(ICultureService cultureService, IContentStateService contentStateService, INodeMapper nodeMapper)
            : base(cultureService, contentStateService, nodeMapper)
        {
        }

        public override ClientProfile Get(Guid nodeId)
        {
            return Get(nodeId, CultureInfo.InvariantCulture, ContentState.Draft);
        }
    }

    public interface IClientProfileRepository<T> : IMedianamikRepository<T>
        where T : Interfaces.IClientProfile
    {
    }

    public interface IClientProfileRepository : IClientProfileRepository<ClientProfile>
    {
    }
}
